//
//  ReadNormalTableViewCell.m
//  SuperNews
//
//  Created by dllo on 16/1/11.
//  Copyright © 2016年 qiang. All rights reserved.
//

#import "ReadNormalTableViewCell.h"

#define PAD 10

@interface ReadNormalTableViewCell ()

@property (nonatomic, strong) UIImageView *imageV;

@end

@implementation ReadNormalTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews
{
    self.backgroundColor = [UIColor whiteColor];
    
    self.imageVMain = [UIImageView new];
//    self.imageVMain.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.imageVMain];
    
    self.labelTitle = [UILabel new];
//    self.labelTitle.backgroundColor = [UIColor grayColor];
    self.labelTitle.numberOfLines = 0;
//    self.labelTitle.lineBreakMode = NSLineBreakByWordWrapping;
//    CGSize size = [self.labelTitle sizeThatFits:CGSizeMake(self.labelTitle.frame.size.width, MAXFLOAT)];
//    self.labelTitle.frame =CGRectMake(10, 100, 300, size.height);
    [self.contentView addSubview:self.labelTitle];
    
    self.labelFrom = [UILabel new];
//    self.labelFrom.backgroundColor = [UIColor greenColor];
    self.labelFrom.textColor = [UIColor colorWithRed:0.6941 green:0.6905 blue:0.6977 alpha:1.0];
    self.labelFrom.font = [UIFont systemFontOfSize:13.0];
    [self.contentView addSubview:self.labelFrom];
    
    self.imageV = [UIImageView new];
    self.imageV.image = [UIImage imageNamed:@"recommendlist_cell_close"];
    [self.contentView addSubview:self.imageV];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    [self.imageVMain mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).mas_offset(PAD);
        make.left.equalTo(self.contentView.mas_left).mas_offset(PAD);
        make.bottom.equalTo(self.contentView.mas_bottom).mas_offset(-PAD);
        make.right.equalTo(self.labelTitle.mas_left).mas_offset(-PAD);
        make.width.mas_equalTo(130);
    }];
    [self.labelTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).mas_offset(PAD);
        make.left.equalTo(self.imageVMain.mas_right).mas_offset(PAD);
        make.right.equalTo(self.contentView.mas_right).mas_offset(-PAD);
        make.height.mas_equalTo(80);
    }];
    [self.labelFrom mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.imageVMain.mas_right).mas_offset(PAD);
        make.right.equalTo(self.imageV.mas_left).mas_offset(-PAD);
        make.bottom.equalTo(self.contentView.mas_bottom).mas_offset(-PAD);
        make.height.mas_equalTo(15);
    }];
    [self.imageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.labelFrom.mas_right).mas_offset(PAD);
        make.right.equalTo(self.contentView.mas_right).mas_offset(-PAD);
        make.bottom.equalTo(self.contentView.mas_bottom).mas_offset(-PAD);
        make.width.mas_equalTo(20);
        make.height.mas_equalTo(15);
    }];
    
}

@end
